
<!--公用组件：固定宽度的带图标的输入框
      /**
      * @author 龙伟
      * @date 2019年10月24日
      * @desc 实时监听传入的值，实时回调, 父组件处理回调的值
      * 用法：
      */
       -->
<template>
  <el-input
    v-model="value2"
    @keyup.enter="search"
    :placeholder="placeholder"
    clearable
    :maxlength="maxlength"
    :disabled="disabled"
    class="filter-item"
  ></el-input>
</template>

<script>
  export default {
    name: 'templateInput',
    props: {
      maxlength: {
        type: Number,
        default: 200
      },
      disabled: {
        type: Boolean,
        default: false
      },
      icons: {
        type: String,
        default: 'search'
      },
      value: {
        type: String,
        default: ''
      },
      placeholder: {
        type: String,
        default() {
          return this.$t('placeholder.content')
        }
      }
    },

    computed: {
      value2: {
        get() {
          return this.value;
        },
        set(val) {
          this.$emit('input', val);
          // this.$emit('searchChange', val)
        }
      }
    },
    methods: {
      search() {
        this.$emit('input', this.value);
        this.$emit('searchChange', this.value);
      }
    }
  };
</script>

<style lang="scss" scoped>
  .zl-input-flexd {
    font-size: 14px;
    color: #888;
    display: inline-block;
    border: 1px solid #ddd;
    padding-right: 10px;
    width: 100%;

    .input {
      width: calc(100% - 16px);
      border: none;
      height: 28px;
      padding-left: 10px;
      outline: none;
    }
    .search {
      width: 16px;
      height: 16px;
      vertical-align: middle;
    }
  }
</style>


